﻿namespace MyThirdCSharp
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //设置初始位置x,y
            int x = 0, y = 0;
            ConsoleKey input;
            

            //在初始位置输出string
            do
            {
                Console.Clear();//清屏
                string s = "Holle World";
                Console.SetCursorPosition(x, y);
                Console.Write(s);

                //用户输入位置
                input = Console.ReadKey(true).Key;//true用来隐藏光标

                //根据用户的输入改变位置
                switch (input)
                {
                    case ConsoleKey.Enter:
                        break;
                    case ConsoleKey.A:
                        if (x > 0)
                        {
                            x--;
                        }
                        break;
                    case ConsoleKey.D:
                        if (x < 109)
                        {
                            x++;
                        }
                        break;
                    case ConsoleKey.W:
                        if (y > 0)
                        {
                            y--;
                        }
                        break;
                    case ConsoleKey.S:
                        if (y < 80)
                        {
                            y++;
                        }
                        break;
                    default:
                        break;
                }
            } while (input != ConsoleKey.Enter);
        }
    }
}
        
   